<template>
  <div>
    <div class="search">
      <div class="item">
        <el-input placeholder="产品编号" v-model="proID"></el-input>
        <el-button type="success" @click="search(proID)">查询</el-button>
      </div>
    </div>
    <div class="table_info">
      <el-table :data="tableData" stripe style="width: 100%" height="400">
        <el-table-column prop="proID" label="产品编号" width="150">
        </el-table-column>
        <el-table-column prop="proName" label="产品名称" width="150">
        </el-table-column>
        <el-table-column prop="supplier" label="供应商名称" width="150"> </el-table-column>
     
        <el-table-column prop="n" label="库存" >
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
import axios from "axios";
import qs from 'qs'
export default {
  data() {
    return {
      tableData: [],
      proID:''
     
    };
  },
  methods:{
    search(id){
      axios({
        url:'http://localhost:3000/searchStore',
        method:'post',
        data:qs.stringify({
          id:id
        })
      }).then((success)=>{
        this.tableData=success.data
      })
    }
  },
    mounted() {
    axios({
      url: "http://localhost:3000/store",
      method: "get",
    }).then((succ) => {
    this.tableData=succ.data
    });
  }
};
</script>

<style scoped>
.search {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}
.item {
  display: flex;
}
</style>